Attribute VB_Name = "Resize"
Option Explicit
Dim objects() As Object
Dim baifen() As Double
Dim rowes() As Long
Public Function setrows(rows As Long)
  ReDim rowes(rows)
End Function
Public Function setrowandcolumn(row As Long, column As Long)
  rowes(row) = column
End Function
Public Function addobject(a As Object, i As Integer, row As Integer, tall As Long, tags As String)
  Set objects(row, i) = a
  objects(row, i).Top = tall
  objects(row, i).Tag = tags
End Function
Public Function objectdimi(i As Long, row As Long)
  Dim j As Long
  j = i * 2 + 1
  ReDim objects(row, i)
  ReDim baifen(row, j)
End Function
Public Function setbaifen(a As Object)
  Dim ll_i, ll_j As Long
  Dim ll_a, ll_b
  For ll_j = 1 To UBound(rowes)
    For ll_i = 1 To rowes(ll_j) * 2 + 1
      If ll_i = 1 Then
         baifen(ll_j, ll_i) = objects(ll_j, ll_i).Left / a.Width
      ElseIf ll_i = rowes(ll_j) * 2 + 1 Then
         baifen(ll_j, ll_i) = (a.Width - objects(ll_j, (rowes(ll_j) - 1)).Left - objects(ll_j, (rowes(ll_j) - 1)).Width) / a.Width
      ElseIf (ll_i Mod 2) = 0 Then
         baifen(ll_j, ll_i) = (objects(ll_j, (ll_i / 2)).Width) / a.Width
      Else
         ll_a = CInt(ll_i / 2 + 0.5)
         baifen(ll_j, ll_i) = objects(ll_j, ll_a).Left / a.Width
      End If
    Next ll_i
  Next ll_j
End Function
Public Function objectresize(f As Object, a As Object, w As Integer)
  Dim ll_i, ll_j As Long
  
  a.Width = f.Width - 200
  For ll_j = 1 To UBound(rowes)
    For ll_i = 1 To rowes(ll_j)
      objects(ll_j, ll_i).Left = baifen(ll_j, (ll_i * 2 - 1)) * a.Width
      If objects(ll_j, ll_i).Tag = "Y" Then
        objects(ll_j, ll_i).Width = baifen(ll_j, (ll_i * 2)) * a.Width
      End If
    Next ll_i
  Next ll_j
End Function
Public Function init()
  Call setrows(2)
  Call setrowandcolumn(1, 8)
  Call setrowandcolumn(2, 7)
  Call objectdimi(8, 2)
  Call addobject(Form1.Label1, 1, 1, 350, "Y")
  Call addobject(Form1.Comb_Dept, 2, 1, 350, "Y")
  Call addobject(Form1.Label2, 3, 1, 350, "Y")
  Call addobject(Form1.DT1, 4, 1, 350, "Y")
  Call addobject(Form1.Label3, 5, 1, 350, "Y")
  Call addobject(Form1.DT2, 6, 1, 350, "Y")
  Call addobject(Form1.Com_Find, 7, 1, 350, "Y")
  Call addobject(Form1.Command1, 8, 1, 350, "Y")
  Call addobject(Form1.Label4, 1, 2, 850, "Y")
  Call addobject(Form1.Text2, 2, 2, 850, "Y")
  Call addobject(Form1.Label5, 3, 2, 850, "Y")
  Call addobject(Form1.Combo2, 4, 2, 850, "Y")
  Call addobject(Form1.Check2, 5, 2, 850, "Y")
  Call addobject(Form1.Com_Clear, 6, 2, 850, "Y")
  Call addobject(Form1.Com_Exit, 7, 2, 850, "Y")
  Call setbaifen(Form1.Frame1)
End Function




